/* THE WHOLE CSS FILE IS ROUGHLY DIVIDED INTO 7 SECTIONS, NAMINGLY:
1. GLOBAL STYLES
2. HEADER SECTION
3. MAIN SECTION
4. FOOTER SECTION
5. POPUP
6. ACCESSORIES & ANIMATIONS
7. MEDIA QUERIES */


/* ====================================================================================GLOBAL STYLES */

@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:ital,wght@0,100..700;1,100..700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  /* outline: 0; */
  scroll-behavior: smooth;
  font-family: "Josefin Sans", sans-serif;
  font-optical-sizing: auto;
  color: gray;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary-color: #22254b;
  --secondary-color: #373b69;
  --tertiary-color: #19063780;
}

:root::-webkit-scrollbar {
  width: 5px;
}

:root::-webkit-scrollbar-thumb {
  background: linear-gradient(white, var(--secondary-color));
  border-radius: 10px;
}

body {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--primary-color);
  overflow-x: hidden;
  border: 1px solid transparent;
}

.fa-solid,
.fa-brands {
  color: wheat;
}

img {
  user-select: none;
}

/*===================================================================================HEADER SECTION */

header {
  position: sticky;
  width: 100vw;
  height: 15%;
  top: 0;
  z-index: 10;
  padding: 1rem;
  color: wheat;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 1rem;
  font-size: 24px;
  background-color: var(--secondary-color);
  box-shadow: 0px 4px 8px var(--tertiary-color);
}

#logo {
  color: wheat;
  cursor: pointer;
  white-space: nowrap;
}

form {
  position: relative;
}

#search {
  background-color: transparent;
  min-width: 25vw;
  border: 2px solid var(--primary-color);
  padding: .7rem 3rem .6rem 1.5rem;
  border-radius: 50px;
  font-size: 1rem;
  color: #fff;
}

#search:focus {
  outline: 0;
  background-color: var(--primary-color);
}

#search::placeholder {
  color: #7378c5;
}

#search-btn {
  position: absolute;
  top: 50%;
  right: 1.5rem;
  transform: translate(0, -50%);
  font-size: 1rem;
  cursor: pointer;
  background-color: transparent;
}

.heading {
  padding: 15vh 0 10vh 0;
  text-align: center;
  font-size: 2rem;
  color: wheat;
  white-space: nowrap;
}

/* ===================================================================================MAIN SECTION */


#display-search-term {
  display: inline-block;
  max-width: 60vw;
  transform: translateY(30%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout-wrapper {
  padding: 0 10vw;
  width: 100vw;
}

.layout-wrapper>div {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-template-rows: auto;
  gap: 3rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

/* The "condensed" class converts the plain grid-layout into a slider */
.condensed {
  grid-auto-flow: column;
}

.layout-wrapper>div::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.layout-wrapper:last-child {
  margin-bottom: 20vh;
}

.layout-wrapper>div:has(:only-child)>* {
  width: 300px;
  place-self: center;
}

.movie-card {
  position: relative;
  width: 100%;
  height: 450px;
  border-radius: 8px;
  box-shadow: 0.2px 4px 5px rgba(0, 0, 0, 1);
  background: linear-gradient(white, var(--secondary-color));
  overflow: hidden;
  scroll-snap-align: start;
}

.img-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}

.img-container img {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;

}

.movie-info {
  position: absolute;
  bottom: 0;
  height: 15%;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  letter-spacing: 0.5px;
  background-color: var(--secondary-color);
}

.movie-info h4 {
  color: wheat;
  line-height: 1.7;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.movie-info div {
  padding: 0.5rem 0.5rem;
  border-radius: 3px;
  font-weight: bold;
}

.rating {
  background-color: var(--primary-color);
  white-space: nowrap;
}

.movie-info div.green {
  color: lightgreen;
}

.movie-info div.orange {
  color: orange;
}

.movie-info div.red {
  color: red;
}

.overview {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  padding: 1rem;
  height: 25%;
  transform: translateY(101%);
  transition: transform 0.3s ease-in-out;
}


.overview::-webkit-scrollbar {
  width: 0;
}

.movie-card:hover .overview {
  transform: translateY(0);
}

.overview p {
  overflow: hidden;
  text-align: justify;
  hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 12;
  -webkit-box-orient: vertical;
  font-size: 14px;
  line-height: 1.7;
  margin-top: 8px;
}

/* ===================================================================================FOOTER SECTION */

footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 0.4rem;
  background-color: #212529;
}

footer h4 {
  color: white;
  text-align: center;
}

#scroll-up {
  display: none;
  position: fixed;
  width: 20px;
  height: 20px;
  bottom: 8vh;
  right: 4vw;
  cursor: pointer;
}

#scroll-up i {
  font-size: 32px;
}

/* ===================================================================================POPUP */

#open-popup {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
}

.popup {
  display: none;
  position: relative;
  position: fixed;
  z-index: 11;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  background-color: #fefefe;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.3s ease-in-out;
}

.fa-triangle-exclamation {
  margin: 5px 0 10px 50%;
  transform: translateX(-50%);
  font-size: 48px;
  margin-bottom: 10px;
}

.popup-content p {
  text-align: justify;
  hyphens: auto;
  line-height: 1.5;
}

.popup-content ul li {
  margin: 10px 0 0 25px;
}

.close-btn {
  color: #aaa;
  float: right;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}


/* ===================================================================================ACCESSORIES & ANIMATIONS */

.skeleton {
  opacity: 0.7;
  animation: skeleton-loading 1s linear infinite alternate;
}

.skeleton-text {
  width: 100%;
  height: .75rem;
  margin-bottom: 0.5rem;
  border-radius: 0.125rem;
}

.skeleton-text:last-child {
  margin-bottom: 0;
  width: 60%;
}

@keyframes skeleton-loading {
  0% {
    background-color: hsl(200, 20%, 70%);
  }

  100% {
    background-color: hsl(200, 20%, 95%);
  }
}

.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid #514b82;
  animation:
    l20-1 0.8s infinite linear alternate,
    l20-2 1.6s infinite linear;
}

@keyframes l20-1 {
  0% {
    clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%)
  }

  12.5% {
    clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 0%, 100% 0%, 100% 0%)
  }

  25% {
    clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 100% 100%, 100% 100%)
  }

  50% {
    clip-path: polygon(50% 50%, 0 0, 50% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%)
  }

  62.5% {
    clip-path: polygon(50% 50%, 100% 0, 100% 0%, 100% 0%, 100% 100%, 50% 100%, 0% 100%)
  }

  75% {
    clip-path: polygon(50% 50%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 50% 100%, 0% 100%)
  }

  100% {
    clip-path: polygon(50% 50%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%, 0% 100%)
  }
}

@keyframes l20-2 {
  0% {
    transform: translate(-50%, -50%) scaleY(1) rotate(0deg)
  }

  49.99% {
    transform: translate(-50%, -50%) scaleY(1) rotate(135deg)
  }

  50% {
    transform: translate(-50%, -50%) scaleY(-1) rotate(0deg)
  }

  100% {
    transform: translate(-50%, -50%) scaleY(-1) rotate(-135deg)
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ===================================================================================MEDIA QUERIES */

@media screen and (max-width: 820px) {
  header {
    flex-direction: column;
  }

  .layout-wrapper {
    padding: 0 8vw;
  }

  .layout-wrapper>div {
    grid-auto-flow: column;
  }
}